import request from '@/utils/request'
import { type hospitalDetail, type hospitalList, type HospitalInfo, type HospitalWordData } from '@/api/type.ts'

// 获取医院等级选项传HosType 或地区选项的接口传地区名称
export function reqHospitalLevelAndRegion(dickCode: string) {
    return request.get('/cmn/dict/findByDictCode/' + dickCode)
}

// 根据地区和等级获取某页医院列表
export function reqHospital(page: number, limit: number, hostype: string, districtCode: string) {
    return request.get<any, hospitalList>('/hosp/hospital/' + `${page}/${limit}?hostype=${hostype}&districtCode=${districtCode}`)
}

// 根据关键字查询医院名称
export function reqHospitalInfo(hosname: string) {
    return request.get<any, HospitalInfo>('/hosp/hospital/findByHosname/' + hosname)
}

// register module
// 获取医院详情信息
export function reqHospitalDetail(hoscpde: string) {
    return request.get<any, hospitalDetail>('/hosp/hospital/' + hoscpde)
}
// 获取医院科室列表
export function reqHospitalDeparment(hoscpde: string) {
    return request.get('/hosp/hospital/department/' + hoscpde)
}

// register_step1 module
// 获取某医院某科室的挂号情况
export function reqHospitalWork(pageNum: number, pageSize: number, hoscode: string, depcode: string) {
    return request.get<any, HospitalWordData>(`/hosp/hospital/auth/getBookingScheduleRule/${pageNum}/${pageSize}/${hoscode}/${depcode}`)
}
// 某医院某一天某科室医生排班情况
export function reqHospitalDoctor(hoscode: string, depcode: string, workDate: string) {
    return request.get('/hosp/hospital/auth/findScheduleList/' + `${hoscode}/${depcode}/${workDate}`)
}
// register_step2 module
// 获取挂号医生信息
export function reqDoctorInfo(scheduleId: string) {
    return request.get('/hosp/hospital/getSchedule/' + scheduleId)
}
// 提交订单，获取订单号码接口
export function reqSubmitOrder(hoscode: string, scheduleId: string, patientId: number) {
    return request.post('/order/orderInfo/auth/submitOrder/' + `${hoscode}/${scheduleId}/${patientId}`)
}
